function l = lagAD(x, Extra)
% lagrange function for auto-differentiation <Extra = {sigma, lambda}>;
% l = sigma * f(x) + \sigma{i=1..n}{ lambda_i * g_i(x) }
% 
global nlp
% f = feval(nlp.func.objective, x); % Hessian = 0 matrix
c = feval(nlp.func.constraints, x);

if iscell(Extra) == 1, lambda = Extra{2};
else lambda = ones(length(c), 1); 
end

l = lambda' * c;                  %l = sigma * f + lambda' * c;

end